﻿@extends('wechat.layouts.base')
@section("js_files")
@endsection
@section("mask")
<img id="share" onclick="hideshare()" style="width:100%; height:100%; position: absolute; left:0;top:0; z-index:999; display: none;" src="{{asset('dist/wechat/img/share.png')}}"/>
@endsection
@section('content')
<img width="100%" src="{{asset('dist/wechat/img/faceh.jpg')}}" />
  @if($data['success'] == true)
            @if($data['face'])
                @foreach($data['face'] as $row)
			<div class="minepk clear">
                    <div class="mface clear">
                        <img src="{{$row->ToFace->attach->path}}" />
                        <p>{{$user->nickname}}</p>
                        <!--<p><span>{{$row->ToFace->value}}</span>分</p>-->
                    </div>
                    <div class="otherface clear">
                        <img src="{{$row->FromFace->attach->path}}" />
                        <p>{{$row->FromFace->users->nickname}}</p>
                        <!--<p><span>{{$row->FromFace->value}}</span>分</p>-->
                    </div>
					  </div>
                @endforeach
                @else
                  <p class="nothing">暂未数据</p>
                @endif
      
		<div class="joinbtn">
            <a style="margin-right:3%;" href="javascript:;">刷脸投票</a>
			<a style="margin-left:3%;"href="javascript:;" onclick="showshare()">撞脸分享</a>
        </div>

        <div class="moreface aface" style="margin:0">
            <h4>其他人的撞脸</h4>
			<!--
			<ul class="mineface">
                @foreach($face as $row)
                    <img src="{{$row->attach->path}}" />
                @endforeach
            </ul>
			-->
			
			<ul class="nflist mmface">
         @if($data['face_list'])
             @foreach($data['face_list'] as $row)
                  <li class="pk clear">
                      <div class="mface mface_ clear">
                          <img src="{{$row->FromFace->attach->path}}" />
                          <p>{{$row->FromFace->users->nickname}}</p>
						  <!--<p><span>{{$row->FromFace->value}}</span>分</p>-->
                      </div>
					  <!--
                      <img class="vs" src=""/>
                      -->
					  <div class="otherface otherface_ clear">
                          <img src="{{$row->ToFace->attach->path}}" />
                          <p>@if($user->id == $row->ToFace->x_uid)  {{$user->nickname}}  @else {{$row->ToFace->users->nickname}}  @endif</p>
						  <!--<p><span>{{$row->ToFace->value}}</span>分</p>-->
					  </div>
                  </li>
              @endforeach
             @else
               <p class="nothing">暂未数据</p>
             @endif
      </ul>
        </div>
  @else
  <ul class="nflist">
		<div class="joinbtn">
            <a style="margin-right:3%;" href="javascript:;">我要参与</a>
			<a style="margin-left:3%;"href="javascript:;" onclick="showshare()">撞脸分享</a>
        </div>
		<h4 style="margin-top:5%;">其他人的撞脸</h4>
         @if($data['face_list'])
             @foreach($data['face_list'] as $row)
                  <li class="pk clear">
                      <div class="mface">
                          <img src="{{$row->FromFace->attach->path}}" />
                          <p style="width:130px; overflow:hidden;">{{$row->FromFace->users->nickname}}</p>
						  <!--<p><span>{{$row->FromFace->value}}</span>分</p>-->
                      </div>
                      <div class="otherface">
                          <img src="{{$row->ToFace->attach->path}}" />
                          <p style="width:130px; overflow:hidden;">@if($user->id == $row->ToFace->x_uid)  {{$user->nickname}}  @else {{$row->ToFace->users->nickname}}  @endif</p>
						 <!--<p><span>{{$row->ToFace->value}}</span>分</p>-->
					  </div>
                  </li>
              @endforeach
             @else
               <p class="nothing">暂时还没有数据</p>
             @endif
      </ul>
      



    @endif
	
    <script>
        var host =window.location.host;
               @if($data['new_face'])
                   var title="我是{{$user->nickname}},在长沙跟我长得最像的居然是{{$data['new_face']->FromFace->users->nickname}},你呢？";
                @else
                   var title="我是{{$user->nickname}},在百万民选中独一无二，和你长得最像的会是谁？";
                @endif


        var desc="700万长沙人中，谁和你长得最像？";
        var share_link="http://"+host+"/wechat/face";
        var share_imgUrl="{{$user->headimgurl}}";
        share(title,share_link,share_imgUrl,desc);
		
		function showshare(){
			$("#share").css("display","block");
		}
		
		function hideshare(){
			$("#share").css("display","none");
		}
    </script>
    @endsection

